<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>par_ui: /home/wouter/ros_packages/thp-pj2-08/par_ui/src/par_ui.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>

<table border="0">
<tr><td valign="top" style="border-right: 1px solid #333; padding-right: 10px;" >
<p>
Project: <a href="http://ros.org/wiki/par_ui">par_ui</a>
</p>
<p>
License: BSD
</p>
<p>
Dependencies: 
<ul>
  <li>std_msgs</li>
  <li>roscpp</li>
  <li>par_kinematics</li>
  <li>par_trajectory_planning</li>
  <li>tinyxml</li>
</ul>
</p>
<p>
Used by:
None<br />
</p>
<p>
<a href="../../index.html">All Packages</a>
</p>

</div>
</td><td valign="top" style="padding-left: 10px;" >
<!-- Generated by Doxygen 1.7.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>/home/wouter/ros_packages/thp-pj2-08/par_ui/src/par_ui.cpp</h1>  </div>
</div>
<div class="contents">
<a href="par__ui_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00007"></a>00007 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;math.h&gt;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;ros/ros.h&gt;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &lt;<a class="code" href="par__config_8h.html">par_ui/par_config.h</a>&gt;</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;<a class="code" href="par__utils_8h.html">par_ui/par_utils.h</a>&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;par_kinematics/coord.h&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;par_trajectory_planning/commands.h&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;par_trajectory_planning/config.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;tinyxml/tinyxml.h&gt;</span>
<a name="l00016"></a>00016 
<a name="l00017"></a><a class="code" href="par__ui_8cpp.html#a9e4984bb4763bc6694e8a9b6a624f79d">00017</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="par__ui_8cpp.html#a9e4984bb4763bc6694e8a9b6a624f79d">QUEUE_SIZE</a> = 1000;
<a name="l00018"></a>00018 
<a name="l00019"></a><a class="code" href="par__ui_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">00019</a> <span class="keywordtype">int</span> <a class="code" href="par__ui_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)
<a name="l00020"></a>00020 {
<a name="l00021"></a>00021     ros::init(argc, argv, <span class="stringliteral">&quot;par_ui&quot;</span>);
<a name="l00022"></a>00022     ros::NodeHandle n;
<a name="l00023"></a>00023     ros::Rate loop_rate(1);
<a name="l00024"></a>00024     ros::ServiceClient coord_client = n.serviceClient&lt;par_kinematics::coord&gt;(<span class="stringliteral">&quot;coord&quot;</span>);
<a name="l00025"></a>00025     ros::Publisher chatter_pub_cmd = n.advertise&lt;par_trajectory_planning::commands&gt;(<span class="stringliteral">&quot;commands&quot;</span>, <a class="code" href="par__ui_8cpp.html#a9e4984bb4763bc6694e8a9b6a624f79d">QUEUE_SIZE</a>);
<a name="l00026"></a>00026             
<a name="l00027"></a>00027     par_trajectory_planning::commands cmd;
<a name="l00028"></a>00028     par_kinematics::coord coords;           
<a name="l00029"></a>00029     <a class="code" href="classConfig.html">Config</a> config(coord_client, coords, cmd, chatter_pub_cmd);
<a name="l00030"></a>00030     std::string file;
<a name="l00031"></a>00031     <span class="keywordtype">int</span> x = 1;
<a name="l00032"></a>00032     <span class="keywordflow">while</span>(ros::ok() &amp;&amp; x)
<a name="l00033"></a>00033     {
<a name="l00034"></a>00034         x = <a class="code" href="par__utils_8h.html#ae83fcdbeb2b6757fc741ae953b633ee1" title="The menu presented to the user.">menu</a>();
<a name="l00035"></a>00035         <span class="keywordflow">switch</span>(x)
<a name="l00036"></a>00036         {
<a name="l00037"></a>00037             <span class="keywordflow">case</span> MENU_INIT_COMM:
<a name="l00038"></a>00038                 cmd.option = MENU_INIT_COMM;
<a name="l00039"></a>00039                 chatter_pub_cmd.publish(cmd);
<a name="l00040"></a>00040             <span class="keywordflow">break</span>;
<a name="l00041"></a>00041             <span class="keywordflow">case</span> MENU_INIT_MOTOR: 
<a name="l00042"></a>00042                 cmd.option = MENU_INIT_MOTOR;
<a name="l00043"></a>00043                 chatter_pub_cmd.publish(cmd);
<a name="l00044"></a>00044             <span class="keywordflow">break</span>;
<a name="l00045"></a>00045             <span class="keywordflow">case</span> MENU_CONF_SIN_MOT:
<a name="l00046"></a>00046                 cmd.option = MENU_CONF_SIN_MOT;
<a name="l00047"></a>00047                         <a class="code" href="par__utils_8h.html#a16f93f2ae5fbda3b2800dce916d374a1" title="Function configuring a single motion.">configure_single_motion</a>(cmd);
<a name="l00048"></a>00048                         chatter_pub_cmd.publish(cmd);
<a name="l00049"></a>00049             <span class="keywordflow">break</span>;
<a name="l00050"></a>00050             <span class="keywordflow">case</span> MENU_CONF_PTP_MOT:
<a name="l00051"></a>00051                 cmd.option = MENU_CONF_PTP_MOT;
<a name="l00052"></a>00052                 <a class="code" href="par__utils_8h.html#a05bc2492b4896b6738d0c181b6f75e4f" title="Function for configuring PTP motions.">configure_PTP_motion</a>(coord_client, coords, cmd);
<a name="l00053"></a>00053                 chatter_pub_cmd.publish(cmd);
<a name="l00054"></a>00054             <span class="keywordflow">break</span>;
<a name="l00055"></a>00055                 <span class="keywordflow">case</span> MENU_RD_CONF_FILE:
<a name="l00056"></a>00056                 cmd.option = MENU_RD_CONF_FILE;
<a name="l00057"></a>00057                 <a class="code" href="par__utils_8h.html#a848151259ce1295c267886885658673a" title="Function for choosing a configuration file.">pick_configuration_file</a>(<span class="stringliteral">&quot;/etc/ROS&quot;</span>, file);
<a name="l00058"></a>00058                         config.<a class="code" href="classConfig.html#a4e9f99ceaf254f82b14e845de037fc5f" title="Function for reading XML configuration file.">read</a>(file);
<a name="l00059"></a>00059                     <span class="keywordflow">break</span>;
<a name="l00060"></a>00060             <span class="keywordflow">case</span> MENU_START_MOT:
<a name="l00061"></a>00061                 cmd.option = MENU_START_MOT;
<a name="l00062"></a>00062                 chatter_pub_cmd.publish(cmd);
<a name="l00063"></a>00063             <span class="keywordflow">break</span>;
<a name="l00064"></a>00064                 <span class="keywordflow">case</span> MENU_STOP_MOT:
<a name="l00065"></a>00065                         cmd.option = MENU_STOP_MOT;
<a name="l00066"></a>00066                         chatter_pub_cmd.publish(cmd);
<a name="l00067"></a>00067                 <span class="keywordflow">break</span>;
<a name="l00068"></a>00068                 <span class="keywordflow">case</span> MENU_START_HM:
<a name="l00069"></a>00069                     cmd.option = MENU_START_HM;
<a name="l00070"></a>00070                     <a class="code" href="par__utils_8h.html#a29c8f7bbfe2e9aa011bf0540863ec03a" title="Function for configuring homing parameters.">configure_homing</a>(cmd);
<a name="l00071"></a>00071                     chatter_pub_cmd.publish(cmd);
<a name="l00072"></a>00072                 <span class="keywordflow">break</span>;
<a name="l00073"></a>00073                 <span class="keywordflow">case</span> MENU_START_TEST:
<a name="l00074"></a>00074                         cmd.option = MENU_START_TEST;
<a name="l00075"></a>00075                         chatter_pub_cmd.publish(cmd);
<a name="l00076"></a>00076                     <span class="keywordflow">break</span>;
<a name="l00077"></a>00077             <span class="keywordflow">case</span> MENU_EXIT:
<a name="l00078"></a>00078                 cmd.option = MENU_EXIT;
<a name="l00079"></a>00079                 chatter_pub_cmd.publish(cmd);
<a name="l00080"></a>00080             <span class="keywordflow">break</span>;
<a name="l00081"></a>00081         }
<a name="l00082"></a>00082     }    
<a name="l00083"></a>00083     
<a name="l00084"></a>00084     <span class="keywordflow">return</span> 0;
<a name="l00085"></a>00085 }
</pre></div></div>
</div>
</td></tr></table>

<hr size="1"><div style="align: right;">
<a href="http://ros.org/wiki/par_ui">par_ui</a><br />
Author(s): Wouter van Teijlingen</br />
<small>autogenerated on Mon Jun 13 2011 17:06:40</small>
</div>
</body>
</html>
